﻿#ifndef CRobMapPlan_H
#define CRobMapPlan_H
/********************************************************************************
** @ Date:2024/03/22
** @ Author: HanJiaXin
** @ Description:机器人路径规划地图，继承于地图基类CMapWidgetBase
** @ Version:1.0.0
** @ ClassName:
** @ Fun:
********************************************************************************/
#include <QWidget>
#include "ui_CRobMapPlan.h"
#include "CMapWidgetBase.h"
#include "CRBaseData.h"
#include "CDevBase.h"

class CRobMapPlan : public CMapWidgetBase
{
	Q_OBJECT

public:
	CRobMapPlan(QWidget *parent = nullptr);
	~CRobMapPlan();
	void setPoints(const QVector<QPointF> &points, QVector<int> vecXData);
	void setActPoints(int nXVal, bool bCharge = false);
	void addPoint();                //添加巡检点
protected:
	void paintEvent(QPaintEvent *event) override;
	void mousePressEvent(QMouseEvent *event) override;
	void mouseReleaseEvent(QMouseEvent *event) override;
	void mouseMoveEvent(QMouseEvent *event) override;

private:
	bool isPointInCir(const QPoint &point, const PointData &rect);
	void getDrawZoomElse();                        //获取缩放过后的坐标点
	double GetAngel(QPointF p1, QPointF p2);       //根据p1和p2计算角度
	void GetDrawActPoint();
signals:
	void sigAddPoint(QPointF pCurrPoint,int nXVal); //通知上层添加巡检点
	void sigMoveMent(int nXVal);                    //通知上层运动到指定点信号
	void sigEditPoint(int nXVal);                   //通知上层编辑巡检点
	void sigMovePoint(int nXVal);                   //通知上层编辑巡检点
	void sigDelPoint(int nXVal);                    //通知上层删除巡检点
	void sigSelectedPoint(int nXVal);				//通知上层选中巡检点

public:
	int           m_nChoseXVal;                    //选中点的X值
private:
	QVector<PointData> m_vecZoomPoint;
	PointData	  m_cRobIncotion;                  //机器人当前位置缩放过后的范围
	PointData     m_DrawLine;                      //旋转线段缩放过后的范围
	bool          m_bSketMoveAble;                 //示意图是否可以移动
	int           m_nChoseIndex;                   //选中的点序号
	Ui::CRobMapPlanClass ui;
};

#endif